Python | Count and display vowels in a string
In this program, we need to count the number of vowels present in a string and display those vowels. This can be done using various methods. In this article, we will go through few of the popular methods to do this in an efficient manner. Examples:...
read more
Python – Retain list elements value items
Sometimes, while working with Python dictionaries, we can have a problem in which we need to retain only those keys, whose values are part of the target list. This kind of problem can have potential problems in many domains including web development. Let’s discuss certain ways in which this task can be performed....
read more
Python – Convert list of dictionaries to dictionary of lists
In this article, we will discuss how to convert a list of dictionaries to a dictionary of lists....
read more
Python – Slice till K dictionary value lists
Given dictionary with value as lists, slice each list till K....
read more
Python – Convert key-values list to flat dictionary
Sometimes, while working with Python dictionaries, we can have a problem in which we need to flatten dictionary of key-value pair pairing the equal index elements together. This can have utilities in web development and Data Science domain. Lets discuss certain way in which this task can be performed....
read more
Python | Remove spaces from dictionary keys
In Python, dictionary is a collection which is unordered, changeable and indexed. Dictionaries are written with curly brackets, and they have keys and values. It is used to hash a particular key. Let’s see how to remove spaces from dictionary keys in Python....
read more
Python | Split given dictionary in half
While working with dictionaries, sometimes we might have a problem in which we need to reduce the space taken by single container and wish to divide the dictionary into 2 halves. Let’s discuss certain ways in which this task can be performed....
read more
Python – Extract ith element of K key’s value
Given a dictionary, extract ith element of K key’s value list....
read more
Python | Multiply Dictionary Value by Constant
Sometimes, while working with dictionaries, we can have a use-case in which we require to multiply a particular key’s value by K in dictionary. It may seem a quite straight forward problem, but catch comes when the existence of a key is not known, hence becomes a 2 step process at times. Let’s discuss certain ways in which this task can be performed. Method #1 : Using get() The get function can be used to initialize a non-existing key with 1 and then the product is possible. By this way the problem of non-existing key can be avoided....
read more
Python – Merge keys by values
Given a dictionary, merge the keys to map to common values....
read more
Python – Dictionary value lists lengths product
Given a dictionary with values as lists, compute the lengths of each list, and find product of all lengths....
read more
Python – Dictionary Values Division
Sometimes, while working with dictionaries, we might have utility problem in which we need to perform elementary operation among the common keys of dictionaries. This can be extended to any operation to be performed. Let’s discuss division of like key values and ways to solve it in this article....
read more